
#include <netinet/in.h>
#include <errno.h>
#include <string.h>

/**
 * gcc -g -c  -o inet_pton_ipv4.o inet_pton_ipv4.c
 */


int inet_aton(const char *, struct in_addr *);

int
inet_pton(int family, const char *strptr, void *addrptr)
{
    if(family == AF_INET)
    {
        struct in_addr in_val;
        if(inet_aton(strptr, &in_val))
        {
            memcpy(addrptr, &in_val, sizeof(struct in_addr));
            return (1);
        }
        return(0);
    }
    return (-1);
}